      <div class="templatemo-content-wrapper">
        <div class="templatemo-content">
        <ul class="nav nav-tabs mytabs">
		  <li  class="active"><a href="<?php echo site_url('kickback/index/id/'.$user['id'])?>">商品列表</a></li>
		  <li role="presentation"><a href="<?php echo site_url('kickback/add/id/'.$user['id'])?>"><i class="fa fa-plus"></i> 添加商品</a></li>
		</ul>
          <div class="row">
            <div class="col-md-12">
             <!-- <div class="btn-group pull-right" id="templatemo_sort_btn">
                <button type="button" class="btn btn-default">Sort by</button>
                <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                  <span class="caret"></span>
                  <span class="sr-only">Toggle Dropdown</span>
                </button>
                <ul class="dropdown-menu" role="menu">
                  <li><a href="#">First Name</a></li>
                  <li><a href="#">Last Name</a></li>
                  <li><a href="#">Username</a></li>
                </ul>
             </div>-->
              <div>
              	  <input type="hidden" id="userid" name="userid" value="<?php echo $user['id'];?>">
            	  <input type="text" id="name" name="name" value="" placeholder="请输入关键字">
            	  <button class="btn btn-primary" id="submit_btn">搜  索</button>
              </div>
              <div class="table-responsive">
                <h4 class="margin-bottom-15"><?php echo $user['shopname'];?>(优先级顺序：设置价，变化价，涨价比例)</h4>
                <table class="table table-striped table-hover table-bordered">
                  <thead>
                    <tr>
                      <th>ID</th>
                      <th>商品名称</th>
                      <th>进货价</th>
                      <th>原价</th>
                      <th>涨价比例</th>
                      <th>新价</th>
                      <th>设置价</th>
                      <th>变化价</th>
                      <th>操作</th>
                    </tr>
                  </thead>
                  <tbody>
                  	<?php foreach ($kickbacks as $item):?>
                    <tr>
                      <td><?php echo $item['id'];?></td>
                      <td>
                      		<?php 
                      			if(!empty($item['newprice'])&&$item['purprice']>$item['newprice']){
                      				echo  '<span style="color:red;">'.$item['name'].'</span>';
                      			}elseif(!empty($item['addprice'])&&$item['purprice']+$item['addprice']>$item['price']){
                      				echo  '<span style="color:blue;">'.$item['name'].'</span>';
                      			}else{
                      				echo $item['name'].'-'.$item['productid'];
                      			}
                      		?>
                      </td>
                      <td><?php echo $item['purprice'];?></td>
                      <td><?php echo $item['price'];?></td>
                      <td><?php echo $item['rate'];?></td>
                   	  <td><?php echo round($item['price']*$item['rate'],2);?></td>
                   	  <td><?php echo $item['newprice'];?></td>
                   	  <td><?php echo $item['addprice'];?></td>
                      <td>
                      	   <a href="<?php echo site_url('kickback/edit/id/'.$item['id'])?>" class=" ">编辑</a>                    
                      	   | <a href="#" class="del" data-id="<?php echo $item['id'];?>" >删除</a>
                      </td>
                    </tr>
                     <?php endforeach;?>
                  </tbody>
                </table>
              </div>
              <!--<ul class="pagination pull-right">
                <li class="disabled"><a href="#">&laquo;</a></li>
                <li class="active"><a href="#">1 <span class="sr-only">(current)</span></a></li>
                <li><a href="#">2 <span class="sr-only">(current)</span></a></li>
                <li><a href="#">3 <span class="sr-only">(current)</span></a></li>
                <li><a href="#">4 <span class="sr-only">(current)</span></a></li>
                <li><a href="#">5 <span class="sr-only">(current)</span></a></li>
                <li><a href="#">&raquo;</a></li>
              </ul>  -->
            </div>
          </div>
           <div class="pagination">
            <?php echo $links ;?>
          </div>
        </div>
      </div>
    <script>
	$(document).ready(function() {
		$("#submit_btn").click(function() {
			var userid = $("#userid").val();
			var name = $("#name").val();
			var url = "<?php echo site_url('kickback/index')?>";
			window.location.href=url+"/id/"+userid+"/name/"+name;
		});
		$("#name").keydown(function(e) {
			if(e.keyCode == 13) {
				var userid = $("#userid").val();
				var name = $("#name").val();
				var url = "<?php echo site_url('kickback/index')?>";
				window.location.href=url+"/id/"+userid+"/name/"+name;
			}
		});
		$(".del").click(function() {
			if(confirm("确定要删除该回扣吗？"))
			{
			var id = $(this).attr("data-id");
			$.ajax({
				url : '<?php echo site_url('kickback/delete')?>',
				type : "post",
				async : true,
				data : {
					'id' : id
				},
				dataType : "json",
				success : function(data) {
					if(data.code)
					{
						alert(data.msg);
						window.location.reload();
					}else{
						alert(data.msg);
					}
					
				}
			});
			}
		});
	}); 
</script>